package burubaka.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-05-04 21:41:09")
/** */
public final class TipsterMeta extends org.slim3.datastore.ModelMeta<burubaka.model.Tipster> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster> iconURL = new org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster>(this, "iconURL", "iconURL");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, java.util.Date> lastLoginTime = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, java.util.Date>(this, "lastLoginTime", "lastLoginTime", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster> nickname = new org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster>(this, "nickname", "nickname");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster> openTab = new org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster>(this, "openTab", "openTab");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster> post = new org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster>(this, "post", "post");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster> userId = new org.slim3.datastore.StringAttributeMeta<burubaka.model.Tipster>(this, "userId", "userId");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.Tipster, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final TipsterMeta slim3_singleton = new TipsterMeta();

    /**
     * @return the singleton
     */
    public static TipsterMeta get() {
       return slim3_singleton;
    }

    /** */
    public TipsterMeta() {
        super("Tipster", burubaka.model.Tipster.class);
    }

    @Override
    public burubaka.model.Tipster entityToModel(com.google.appengine.api.datastore.Entity entity) {
        burubaka.model.Tipster model = new burubaka.model.Tipster();
        model.setIconURL((java.lang.String) entity.getProperty("iconURL"));
        model.setKey(entity.getKey());
        model.setLastLoginTime((java.util.Date) entity.getProperty("lastLoginTime"));
        model.setNickname((java.lang.String) entity.getProperty("nickname"));
        model.setOpenTab((java.lang.String) entity.getProperty("openTab"));
        model.setPost((java.lang.String) entity.getProperty("post"));
        model.setUserId((java.lang.String) entity.getProperty("userId"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("iconURL", m.getIconURL());
        entity.setProperty("lastLoginTime", m.getLastLoginTime());
        entity.setProperty("nickname", m.getNickname());
        entity.setProperty("openTab", m.getOpenTab());
        entity.setProperty("post", m.getPost());
        entity.setProperty("userId", m.getUserId());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        burubaka.model.Tipster m = (burubaka.model.Tipster) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getIconURL() != null){
            writer.setNextPropertyName("iconURL");
            encoder0.encode(writer, m.getIconURL());
        }
        if(m.getLastLoginTime() != null){
            writer.setNextPropertyName("lastLoginTime");
            encoder0.encode(writer, m.getLastLoginTime());
        }
        if(m.getNickname() != null){
            writer.setNextPropertyName("nickname");
            encoder0.encode(writer, m.getNickname());
        }
        if(m.getOpenTab() != null){
            writer.setNextPropertyName("openTab");
            encoder0.encode(writer, m.getOpenTab());
        }
        if(m.getPost() != null){
            writer.setNextPropertyName("post");
            encoder0.encode(writer, m.getPost());
        }
        writer.endObject();
    }

    @Override
    protected burubaka.model.Tipster jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        burubaka.model.Tipster m = new burubaka.model.Tipster();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("iconURL");
        m.setIconURL(decoder0.decode(reader, m.getIconURL()));
        reader = rootReader.newObjectReader("lastLoginTime");
        m.setLastLoginTime(decoder0.decode(reader, m.getLastLoginTime()));
        reader = rootReader.newObjectReader("nickname");
        m.setNickname(decoder0.decode(reader, m.getNickname()));
        reader = rootReader.newObjectReader("openTab");
        m.setOpenTab(decoder0.decode(reader, m.getOpenTab()));
        reader = rootReader.newObjectReader("post");
        m.setPost(decoder0.decode(reader, m.getPost()));
        return m;
    }
}